#!/bin/bash
set -e;

whoname=`whoami`;

wget -qO - https://apt.v2raya.org/key/public-key.asc | sudo tee /etc/apt/keyrings/v2raya.asc;
echo "deb [signed-by=/etc/apt/keyrings/v2raya.asc] https://apt.v2raya.org/ v2raya main" | sudo tee /etc/apt/sources.list.d/v2raya.list

sudo apt update;
sudo apt install v2raya v2ray -y

sudo mkdir  -p /opt/v2raya;sudo chmod -R 755 /opt/v2raya;
sudo chown -R ${whoname} /opt/v2raya;
cp start.sh stop.sh /opt/v2raya/;
chmod -R 755 /opt/v2raya;

echo "start v2raya services......";
/opt/v2raya/start.sh;


